
package com.lzx.iteam.contactssearch.provider;


import android.net.Uri;
import android.provider.BaseColumns;

import java.util.HashMap;

public class ContactsSearchDB {

    public static final String AUTHORITY = "com.lzx.iteam.contactssearch";

    public static final String PERMISSION = "com.lzx.iteam.permission.contactssearch";

    private static final Uri CONTENT_URI_BASE = Uri.parse("content://" + AUTHORITY);

    private static final String ITEM_TYPE_BASE = "vnd.android.cursor.item/";

    private static final String DIR_TYPE_BASE = "vnd.android.cursor.dir/";

   /* public static class ContactInfo implements BaseColumns {

        public static final String CONTACT_ID = "contact_id";

        public static final String RAW_CONTACT_ID = "raw_contact_id";

        public static final String DISPLAY_NAME = "display_name";
        
        public static final String FAMILY_NAME = "family_name";
        
        public static final String MIDDLE_NAME = "middle_name";
        
        public static final String GIVEN_NAME = "given_name";

        public static final String SORT_KEY = "sort_key";
        
        public static final String CREATION_TIME = "creation_time";
        
        public static final String GROUP_NAME = "group_name";
        
        public static final String ORGANIZATION_NAME = "organization_name";
        
        public static final String INDEX_NAME = "index_name";
        
        public static final String PHONE_NUMBER = "phone_number";
        
        public static final String HAVE_PHONE_NUMBER = "have_phone_number";
        
        public static final String PHOTO_ID = "photo_id";
        
        public static final String LOOKUP_KEY = "lookup_key";
        
        public static final String GROUP_ID = "group_id";
        
        public static final String IF_STARRED = "starred";
        
        public static final String SHARED_ADDRESS = "shared_address";
        
        public static final String SHARED_PEOPLE = "shared_people";
        
        public static final String VERSION = "version";
        
        *//** Contains contact info columns *//*
//        protected static final HashMap<String, String> sProjectionMap;
        static {
            sProjectionMap = new HashMap<String, String>();
            sProjectionMap.put(ContactInfo._ID, ContactInfo._ID);
            sProjectionMap.put(ContactInfo.CONTACT_ID, ContactInfo.CONTACT_ID);
            sProjectionMap.put(ContactInfo.RAW_CONTACT_ID, ContactInfo.RAW_CONTACT_ID);
            
            sProjectionMap.put(ContactInfo.DISPLAY_NAME, ContactInfo.DISPLAY_NAME);
            
            sProjectionMap.put(ContactInfo.SORT_KEY, ContactInfo.SORT_KEY);
            sProjectionMap.put(ContactInfo.CREATION_TIME, ContactInfo.CREATION_TIME);
            sProjectionMap.put(ContactInfo.GROUP_NAME, ContactInfo.GROUP_NAME);
            sProjectionMap.put(ContactInfo.GROUP_ID, ContactInfo.GROUP_ID);
            sProjectionMap.put(ContactInfo.ORGANIZATION_NAME, ContactInfo.ORGANIZATION_NAME);
            sProjectionMap.put(ContactInfo.PHONE_NUMBER, ContactInfo.PHONE_NUMBER);
            sProjectionMap.put(ContactInfo.HAVE_PHONE_NUMBER, ContactInfo.HAVE_PHONE_NUMBER);
            
            sProjectionMap.put(ContactInfo.INDEX_NAME, ContactInfo.INDEX_NAME);
            sProjectionMap.put(ContactInfo.PHOTO_ID, ContactInfo.PHOTO_ID);
            sProjectionMap.put(ContactInfo.LOOKUP_KEY, ContactInfo.LOOKUP_KEY);
            sProjectionMap.put(ContactInfo.IF_STARRED, ContactInfo.IF_STARRED);
            sProjectionMap.put(ContactInfo.SHARED_ADDRESS, ContactInfo.SHARED_ADDRESS);
            sProjectionMap.put(ContactInfo.SHARED_PEOPLE, ContactInfo.SHARED_PEOPLE);
            
            sProjectionMap.put(ContactInfo.FAMILY_NAME, ContactInfo.FAMILY_NAME);
            sProjectionMap.put(ContactInfo.MIDDLE_NAME, ContactInfo.MIDDLE_NAME);
            sProjectionMap.put(ContactInfo.GIVEN_NAME, ContactInfo.GIVEN_NAME);
            
            sProjectionMap.put(ContactInfo.VERSION, ContactInfo.VERSION);
        }
        
//        public static final String TABLE_NAME = "contact_info";

        protected static final String PATH = "contact_info";

        protected static final String ID_PATH = PATH + "/#";

        public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);

        public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-contactinfo";

        public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-contactinfo";
    }*/

    public static class CommunicationRule implements BaseColumns {

        public static final String CONTACT_ID = "contact_id";
        
        public static final String PHONE_NUMBER = "phone_number";
        
        public static final String CONTACT_NAME = "contact_name";

        public static final String PATTERN = "pattern";

        protected static final HashMap<String, String> sProjectionMap;

        static {
            sProjectionMap = new HashMap<String, String>();
            sProjectionMap.put(CommunicationRule._ID, CommunicationRule._ID);
            sProjectionMap.put(CommunicationRule.PHONE_NUMBER, CommunicationRule.PHONE_NUMBER);
            sProjectionMap.put(CommunicationRule.PATTERN, CommunicationRule.PATTERN);
            sProjectionMap.put(CommunicationRule.CONTACT_ID, CommunicationRule.CONTACT_ID);
            sProjectionMap.put(CommunicationRule.CONTACT_NAME, CommunicationRule.CONTACT_NAME);
        }

        /**
         * The name of this table.
         */
        public static final String TABLE_NAME = "communication_rule";

        protected static final String PATH = "communication_rule";
       
        protected static final String ID_PATH = PATH + "/#";

        public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);

        public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-communication_rule";

        public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-communication_rule";

    }
    
    public static class AcquaintanceCommunication implements BaseColumns{
        
        public static final String CIRCLE_ID = "circle_id";
        
        public static final String CIRCLE_NAME = "circle_name";
        
        public static final String CIRCLE_CREATER = "circle_creater";
        
        public static final String CIRCLE_VERSION = "circle_version";
        
        public static final String CIRCLE_UID = "circle_uid";
        
        public static final String TABLE_NAME = "acquaintance_circle";
        
        public static final String PATH = "acquaintance_circle";
        
        public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
        
        protected static final String ID_PATH = PATH + "/#";
        
        public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-circle_id";
        
        public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-circle_id";

        protected static final HashMap<String, String> mCircleMap;
        
        static {
            
            mCircleMap = new HashMap<String, String>();
            mCircleMap.put(AcquaintanceCommunication._ID, AcquaintanceCommunication._ID);
            mCircleMap.put(AcquaintanceCommunication.CIRCLE_ID, AcquaintanceCommunication.CIRCLE_ID);
            mCircleMap.put(AcquaintanceCommunication.CIRCLE_NAME, AcquaintanceCommunication.CIRCLE_NAME);
            mCircleMap.put(AcquaintanceCommunication.CIRCLE_CREATER, AcquaintanceCommunication.CIRCLE_CREATER);
            mCircleMap.put(AcquaintanceCommunication.CIRCLE_VERSION, AcquaintanceCommunication.CIRCLE_VERSION);
            mCircleMap.put(AcquaintanceCommunication.CIRCLE_UID, AcquaintanceCommunication.CIRCLE_UID);
            
        }
        
    }
    
    public static class CircleMember implements BaseColumns{
        
        public static final String MEMBER_NAME = "member_name";
        
        public static final String MEMBER_NUMBER = "member_number";
        
        public static final String CIRCLE_ID = "circle_id";
        
        public static final String UID = "uid";
        
        public static final String TABLE_NAME = "circle_member";
        
        public static final String PATH = "circle_member";
        
        public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
        
        protected static final String ID_PATH = PATH + "/#";
        
        public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-member_id";
        
        public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-member_id";
        
        protected static final HashMap<String, String> mMemberMap;
        
        static{
            
            mMemberMap = new HashMap<String, String>();
            mMemberMap.put(CircleMember._ID, CircleMember._ID);
            mMemberMap.put(CircleMember.MEMBER_NAME, CircleMember.MEMBER_NAME);
            mMemberMap.put(CircleMember.MEMBER_NUMBER, CircleMember.MEMBER_NUMBER);
            mMemberMap.put(CircleMember.UID, CircleMember.UID);
        }
    }
    
 public static class CircleChatLog implements BaseColumns{
        
        public static final String GROUP_ID = "group_id";
        
        public static final String  INSERT_TIME= "insert_time";
        
        public static final String MSG_STATUS = "msg_status";
        
        public static final String CONTENT = "content";
        
        public static final String BOX_TYPE = "box_type";
        
        public static final String MIME_TYPE = "mime_type";
        
        public static final String SENDER_NUMBER = "sender_number";
        
        public static final String BINARY_CONTENT = "binary_content";
        
        public static final String UID = "uid";
        
        public static final String TABLE_NAME = "circle_chat_log";
        
        public static final String PATH = "circle_chat_log";
        
        public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
        
        protected static final String ID_PATH = PATH + "/#";
        
        public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-circle_chat_log";
        
        public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-circle_chat_log";
        
        protected static final HashMap<String, String> log;
        
        static{
            
            log = new HashMap<String, String>();
            log.put(CircleChatLog._ID, CircleChatLog._ID);
            log.put(CircleChatLog.GROUP_ID, CircleChatLog.GROUP_ID);
            log.put(CircleChatLog.INSERT_TIME, CircleChatLog.INSERT_TIME);
            log.put(CircleChatLog.MSG_STATUS, CircleChatLog.MSG_STATUS);
            log.put(CircleChatLog.CONTENT, CircleChatLog.CONTENT);
            log.put(CircleChatLog.BOX_TYPE, CircleChatLog.BOX_TYPE);
            log.put(CircleChatLog.MIME_TYPE, CircleChatLog.MIME_TYPE);
            log.put(CircleChatLog.SENDER_NUMBER, CircleChatLog.SENDER_NUMBER);
            log.put(CircleChatLog.BINARY_CONTENT, CircleChatLog.BINARY_CONTENT);
            log.put(CircleChatLog.UID, CircleChatLog.UID);
        }
    }
 
 public static class StateData implements BaseColumns{
     
     public static final String STATE_ID = "state_id";
     
     public static final String STATE_TEXT = "state_text";
     
     public static final String TABLE_NAME = "state_table";
     
     public static final String PATH = "state_table";
     
     public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
     
     protected static final String ID_PATH = PATH + "/#";
     
     public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-state_table";
     
     public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-state_table";
     
     protected static final HashMap<String, String> state_map;
     
     static{
         
         state_map = new HashMap<String, String>();
         state_map.put(StateData.STATE_ID, StateData.STATE_ID);
         state_map.put(StateData.STATE_TEXT, StateData.STATE_TEXT);
         
     }
 }


//     public static class CloudId2ContactId implements BaseColumns {
//         
//         public static final String CLOUD_ID = "cloud_id";
//         
//         public static final String CONTACT_ID = "contact_id";
//         
//         public static final String PHONE_NUMBER = "phone_number";
//         
//         public static final int RELATIONSHIP_PENDING_UPLOAD = 1;
//         public static final int RELATIONSHIP_UPLOADED = 2;
//         public static final int RELATIONSHIP_SETUP = 3;
//         public static final int RELATIONSHIP_PENDING_DELETE = 4;
//         public static final String RELATIONSHIP_STATE  = "relationship_state";
//         
//         public static final String CONTACT_STATUS_DISTURB = "contact_status_disturb";
//         
//         public static final String CONTACT_STATUS = "contact_status";
//         
//         public static final String IS_READED = "is_readed";
//         
//         public static final String TABLE_NAME = "cloud_id2contact_id";
//         
//         public static final String PATH = "cloud_id2contact_id";
//         
//         public static final String ID_PATH = PATH + "/#";
//         
//         public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
//         
//         public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-cloud_id2contact_id";
//         
//         public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-cloud_id2contact_id";
//         
//         protected static final HashMap<String, String> ID_MAP;
//         
//         static{
//             ID_MAP = new HashMap<String, String>();
//             ID_MAP.put(_ID, _ID);
//             ID_MAP.put(CLOUD_ID, CLOUD_ID);
//             ID_MAP.put(CONTACT_ID, CONTACT_ID);
//             ID_MAP.put(PHONE_NUMBER, PHONE_NUMBER);
//             ID_MAP.put(RELATIONSHIP_STATE, RELATIONSHIP_STATE);
//             ID_MAP.put(CONTACT_STATUS, CONTACT_STATUS);
//             ID_MAP.put(CONTACT_STATUS_DISTURB, CONTACT_STATUS_DISTURB);
//             ID_MAP.put(IS_READED, IS_READED);
//         }
//     }
 
     public static class MsgItem implements BaseColumns {
         
         public static final int UNREAD = 0;
         public static final int READED = 1;
         public static final int OTHER = 2;
         public static final String COUNT    = "count(*)";
         public static final String CLOUD_ID = "cloud_id";
         public static final String PHONE_NUM = "phone_num";
         public static final String IS_READED = "is_readed";
         public static final String EXEC_CODE = "execcode";
         public static final String DISPLAY_TEXT = "display_text";
         public static final String ARG_LIST = "arg_list";
         public static final String DATE_TIME = "date_time";
         public static final String MSG_TYPE_DRAWABLE_ID = "msg_type_drawable_id";
         public static final String NEXT_ACTION_DRAWABLE_ID = "next_action_drawable_id";
         public static final String CLOUD_GROUP_GROUPID = "cloud_group_id";
         public static final String CLOUD_GROUP_INVITECODE = "cloud_group_invitecode";
         
         public static final String TABLE_NAME = "msg_item";
         public static final String PATH = "msg_item";
         public static final String ID_PATH = PATH + "/#";
         public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
         
         public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-msg_item";
         public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-msg_item";
         
         protected static final HashMap<String, String> MSG_ITEM_MAP;
         static{
             MSG_ITEM_MAP = new HashMap<String, String>();
             MSG_ITEM_MAP.put(_ID, _ID);
             MSG_ITEM_MAP.put(CLOUD_ID, CLOUD_ID);
             MSG_ITEM_MAP.put(PHONE_NUM, PHONE_NUM);
             MSG_ITEM_MAP.put(IS_READED, IS_READED);
             MSG_ITEM_MAP.put(EXEC_CODE, EXEC_CODE);
             MSG_ITEM_MAP.put(DISPLAY_TEXT, DISPLAY_TEXT);
             MSG_ITEM_MAP.put(ARG_LIST, ARG_LIST);
             MSG_ITEM_MAP.put(DATE_TIME, DATE_TIME);
             MSG_ITEM_MAP.put(MSG_TYPE_DRAWABLE_ID, MSG_TYPE_DRAWABLE_ID);
             MSG_ITEM_MAP.put(NEXT_ACTION_DRAWABLE_ID, NEXT_ACTION_DRAWABLE_ID);
             MSG_ITEM_MAP.put(COUNT, COUNT);
             MSG_ITEM_MAP.put(CLOUD_GROUP_GROUPID,CLOUD_GROUP_GROUPID);
             MSG_ITEM_MAP.put(CLOUD_GROUP_INVITECODE,CLOUD_GROUP_INVITECODE);
         }
     }
     
     public static class CloudGroupDbo implements BaseColumns {
         
         public static final String GROUP_ID = "group_id";
         public static final String GROUP_NAME = "group_name"; 
         public static final String GROUP_DESC = "group_desc";
         public static final String GROUP_TYPE = "group_type"; 
         public static final String CONTACT_COUNT = "contact_count";  
         public static final String IS_CREATOR = "is_creator";
         public static final String MEMBER_COUNT = "member_count";
         public static final String UPDATE_TIME = "update_time";
         public static final String CREATOR_UID = "creator_uid";
         
         public static final String TABLE_NAME = "cloud_group";
         public static final String PATH = "cloud_group";
         public static final String ID_PATH = PATH + "/#";
         public static final Uri CONTENT_URI = Uri.withAppendedPath(CONTENT_URI_BASE, PATH);
         
         public static final String CONTENT_TYPE = DIR_TYPE_BASE + "contactssearch-cloud_group";
         public static final String CONTENT_ITEM_TYPE = ITEM_TYPE_BASE + "contactssearch-cloud_group";
         
         protected static final HashMap<String, String> CLOUD_GROUP_MAP;
         static{
             CLOUD_GROUP_MAP = new HashMap<String, String>();
             CLOUD_GROUP_MAP.put(_ID, _ID);
             CLOUD_GROUP_MAP.put(GROUP_ID, GROUP_ID);
             CLOUD_GROUP_MAP.put(GROUP_NAME, GROUP_NAME);
             CLOUD_GROUP_MAP.put(GROUP_TYPE, GROUP_TYPE);
             CLOUD_GROUP_MAP.put(GROUP_DESC, GROUP_DESC);
             CLOUD_GROUP_MAP.put(IS_CREATOR, IS_CREATOR);
             CLOUD_GROUP_MAP.put(CREATOR_UID, CREATOR_UID);
             CLOUD_GROUP_MAP.put(CONTACT_COUNT, CONTACT_COUNT);
             CLOUD_GROUP_MAP.put(MEMBER_COUNT, MEMBER_COUNT);
             CLOUD_GROUP_MAP.put(UPDATE_TIME, UPDATE_TIME);
         }
     }
}
